﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AcmeSportsStore
{
    class CustomersItem: IComparable
    {
        protected int custId;
        protected string custName;
        protected string custAddress;
        protected long custPhone;

        public CustomersItem(int id, string name, string address, long phone)
        {
            this.custId = id;
            this.custName = name;
            this.custAddress = address;
            this.custPhone = phone;
        }

        public int CustId
        {
            get { return custId;  }
            set { custId = value;    }
        }

        public string CustName
        {
            get { return custName;   }
            set { custName = value;  }
        }

        public string CustAddress
        {
            get { return custAddress;    }
            set { custAddress = value; }
        }

        public long CustPhone
        {
            get { return custPhone;   }
            set { custPhone = value;     }
        }

        public int CompareTo(object obj)
        {
            CustomersItem that = (CustomersItem)obj;
            return this.CustId.CompareTo(that.CustId);
        }

        /*
         * Convert phone number to string "0000 0000"
          */
        public string PhoneToString(long phone)
        {
            string sPhone = Convert.ToString(phone).Insert(4, " ");
            return sPhone;
        }

        public override string ToString()
        {
            return custId + "; " + custName + "; " + custAddress + "; " + custPhone;
        } 

    }
}
